
'===============================================================================
'  Generated From - VbNet_SQL_dOOdads_BusinessEntity.vbgen
' 
'  ** IMPORTANT  **
'  How to Generate your stored procedures:
' 
'  SQL        = SQL_StoredProcs.vbgen
'  ACCESS     = Access_StoredProcs.vbgen
'  ORACLE     = Oracle_StoredProcs.vbgen
'  FIREBIRD   = FirebirdStoredProcs.vbgen
'  POSTGRESQL = PostgreSQL_StoredProcs.vbgen
'
'  The supporting base class SqlClientEntity is in the Architecture directory in "dOOdads".
'  
'  This object is 'MustInherit' which means you need to inherit from it to be able
'  to instantiate it.  This is very easilly done. You can Override properties and
'  methods in your derived class, this allows you to regenerate this class at any
'  time and not worry about overwriting custom code. 
'
'  NEVER EDIT THIS FILE.
'
'  Public Class YourObject
'    Inherits _YourObject
'
'  End Class
'
'===============================================================================

' Generated by MyGeneration Version # (1.3.0.3)

Imports System
Imports System.Data
Imports System.Data.SqlClient
Imports System.Collections
Imports System.Collections.Specialized

Imports MyGeneration.dOOdads

NameSpace Class_RC

Public MustInherit Class _MOV_MATERIALES
	Inherits SqlClientEntity

		Public Sub New() 
			Me.QuerySource = "MOV_MATERIALES"
			Me.MappingName = "MOV_MATERIALES"
		End Sub

	'=================================================================
	'  Public Overrides Sub AddNew()
	'=================================================================
	'
	'=================================================================
	Public Overrides Sub AddNew()
		MyBase.AddNew()
				
	End Sub
	
	Public Overrides Sub FlushData()
		Me._whereClause = nothing
		Me._aggregateClause = nothing		
		MyBase.FlushData()
	End Sub
	
		
	'=================================================================
	'  	Public Function LoadAll() As Boolean
	'=================================================================
	'  Loads all of the records in the database, and sets the currentRow to the first row
	'=================================================================
	Public Function LoadAll() As Boolean
	
		Dim parameters As ListDictionary = Nothing
		
		
    	Return MyBase.LoadFromSql("[" + Me.SchemaStoredProcedure + "proc_MOV_MATERIALESLoadAll]", parameters)
		
	End Function

	'=================================================================
	' Public Overridable Function LoadByPrimaryKey()  As Boolean
	'=================================================================
	'  Loads a single row of via the primary key
	'=================================================================
        Public Overridable Function LoadByPrimaryKey(ByVal CodMovMaterial As Integer) As Boolean

            Dim parameters As ListDictionary = New ListDictionary()
            parameters.Add(_MOV_MATERIALES.Parameters.CodMovMaterial, CodMovMaterial)


            Return MyBase.LoadFromSql("[" + Me.SchemaStoredProcedure + "proc_MOV_MATERIALESLoadByPrimaryKey]", parameters)

        End Function

#Region "Parameters"
        Protected Class Parameters

            Public Shared ReadOnly Property CodMovMaterial As SqlParameter
                Get
                    Return New SqlParameter("@CodMovMaterial", SqlDbType.Int, 0)
                End Get
            End Property

            Public Shared ReadOnly Property CodNota As SqlParameter
                Get
                    Return New SqlParameter("@CodNota", SqlDbType.Int, 0)
                End Get
            End Property

            Public Shared ReadOnly Property CodCompra As SqlParameter
                Get
                    Return New SqlParameter("@CodCompra", SqlDbType.Int, 0)
                End Get
            End Property

            Public Shared ReadOnly Property Fecha As SqlParameter
                Get
                    Return New SqlParameter("@Fecha", SqlDbType.DateTime, 0)
                End Get
            End Property

            Public Shared ReadOnly Property CodSeccion As SqlParameter
                Get
                    Return New SqlParameter("@CodSeccion", SqlDbType.Int, 0)
                End Get
            End Property

            Public Shared ReadOnly Property MovimientoTipo As SqlParameter
                Get
                    Return New SqlParameter("@MovimientoTipo", SqlDbType.NVarChar, 50)
                End Get
            End Property

            Public Shared ReadOnly Property CodUsuario As SqlParameter
                Get
                    Return New SqlParameter("@CodUsuario", SqlDbType.Int, 0)
                End Get
            End Property

            Public Shared ReadOnly Property FechaActualizacion As SqlParameter
                Get
                    Return New SqlParameter("@FechaActualizacion", SqlDbType.DateTime, 0)
                End Get
            End Property

            Public Shared ReadOnly Property CodResponsable As SqlParameter
                Get
                    Return New SqlParameter("@CodResponsable", SqlDbType.Int, 0)
                End Get
            End Property

        End Class
#End Region

#Region "ColumnNames"
        Public Class ColumnNames

            Public Const CodMovMaterial As String = "codMovMaterial"
            Public Const CodNota As String = "codNota"
            Public Const CodCompra As String = "codCompra"
            Public Const Fecha As String = "fecha"
            Public Const CodSeccion As String = "codSeccion"
            Public Const MovimientoTipo As String = "movimientoTipo"
            Public Const CodUsuario As String = "codUsuario"
            Public Const FechaActualizacion As String = "fechaActualizacion"
            Public Const CodResponsable As String = "codResponsable"

            Public Shared Function ToPropertyName(ByVal columnName As String) As String

                If ht Is Nothing Then

                    ht = New Hashtable

                    ht(CodMovMaterial) = _MOV_MATERIALES.PropertyNames.CodMovMaterial
                    ht(CodNota) = _MOV_MATERIALES.PropertyNames.CodNota
                    ht(CodCompra) = _MOV_MATERIALES.PropertyNames.CodCompra
                    ht(Fecha) = _MOV_MATERIALES.PropertyNames.Fecha
                    ht(CodSeccion) = _MOV_MATERIALES.PropertyNames.CodSeccion
                    ht(MovimientoTipo) = _MOV_MATERIALES.PropertyNames.MovimientoTipo
                    ht(CodUsuario) = _MOV_MATERIALES.PropertyNames.CodUsuario
                    ht(FechaActualizacion) = _MOV_MATERIALES.PropertyNames.FechaActualizacion
                    ht(CodResponsable) = _MOV_MATERIALES.PropertyNames.CodResponsable

                End If

                Return CType(ht(columnName), String)

            End Function

            Private Shared ht As Hashtable = Nothing
        End Class
#End Region

#Region "PropertyNames"
        Public Class PropertyNames

            Public Const CodMovMaterial As String = "CodMovMaterial"
            Public Const CodNota As String = "CodNota"
            Public Const CodCompra As String = "CodCompra"
            Public Const Fecha As String = "Fecha"
            Public Const CodSeccion As String = "CodSeccion"
            Public Const MovimientoTipo As String = "MovimientoTipo"
            Public Const CodUsuario As String = "CodUsuario"
            Public Const FechaActualizacion As String = "FechaActualizacion"
            Public Const CodResponsable As String = "CodResponsable"

            Public Shared Function ToColumnName(ByVal propertyName As String) As String

                If ht Is Nothing Then

                    ht = New Hashtable

                    ht(CodMovMaterial) = _MOV_MATERIALES.ColumnNames.CodMovMaterial
                    ht(CodNota) = _MOV_MATERIALES.ColumnNames.CodNota
                    ht(CodCompra) = _MOV_MATERIALES.ColumnNames.CodCompra
                    ht(Fecha) = _MOV_MATERIALES.ColumnNames.Fecha
                    ht(CodSeccion) = _MOV_MATERIALES.ColumnNames.CodSeccion
                    ht(MovimientoTipo) = _MOV_MATERIALES.ColumnNames.MovimientoTipo
                    ht(CodUsuario) = _MOV_MATERIALES.ColumnNames.CodUsuario
                    ht(FechaActualizacion) = _MOV_MATERIALES.ColumnNames.FechaActualizacion
                    ht(CodResponsable) = _MOV_MATERIALES.ColumnNames.CodResponsable

                End If

                Return CType(ht(propertyName), String)

            End Function

            Private Shared ht As Hashtable = Nothing

        End Class
#End Region

#Region "StringPropertyNames"
        Public Class StringPropertyNames

            Public Const CodMovMaterial As String = "s_CodMovMaterial"
            Public Const CodNota As String = "s_CodNota"
            Public Const CodCompra As String = "s_CodCompra"
            Public Const Fecha As String = "s_Fecha"
            Public Const CodSeccion As String = "s_CodSeccion"
            Public Const MovimientoTipo As String = "s_MovimientoTipo"
            Public Const CodUsuario As String = "s_CodUsuario"
            Public Const FechaActualizacion As String = "s_FechaActualizacion"
            Public Const CodResponsable As String = "s_CodResponsable"

        End Class
#End Region

#Region "Properties"
        Public Overridable Property CodMovMaterial As Integer
            Get
                Return MyBase.Getint(ColumnNames.CodMovMaterial)
            End Get
            Set(ByVal Value As Integer)
                MyBase.Setint(ColumnNames.CodMovMaterial, Value)
            End Set
        End Property

        Public Overridable Property CodNota As Integer
            Get
                Return MyBase.Getint(ColumnNames.CodNota)
            End Get
            Set(ByVal Value As Integer)
                MyBase.Setint(ColumnNames.CodNota, Value)
            End Set
        End Property

        Public Overridable Property CodCompra As Integer
            Get
                Return MyBase.Getint(ColumnNames.CodCompra)
            End Get
            Set(ByVal Value As Integer)
                MyBase.Setint(ColumnNames.CodCompra, Value)
            End Set
        End Property

        Public Overridable Property Fecha As DateTime
            Get
                Return MyBase.GetDateTime(ColumnNames.Fecha)
            End Get
            Set(ByVal Value As DateTime)
                MyBase.SetDateTime(ColumnNames.Fecha, Value)
            End Set
        End Property

        Public Overridable Property CodSeccion As Integer
            Get
                Return MyBase.Getint(ColumnNames.CodSeccion)
            End Get
            Set(ByVal Value As Integer)
                MyBase.Setint(ColumnNames.CodSeccion, Value)
            End Set
        End Property

        Public Overridable Property MovimientoTipo As String
            Get
                Return MyBase.Getstring(ColumnNames.MovimientoTipo)
            End Get
            Set(ByVal Value As String)
                MyBase.Setstring(ColumnNames.MovimientoTipo, Value)
            End Set
        End Property

        Public Overridable Property CodUsuario As Integer
            Get
                Return MyBase.Getint(ColumnNames.CodUsuario)
            End Get
            Set(ByVal Value As Integer)
                MyBase.Setint(ColumnNames.CodUsuario, Value)
            End Set
        End Property

        Public Overridable Property FechaActualizacion As DateTime
            Get
                Return MyBase.GetDateTime(ColumnNames.FechaActualizacion)
            End Get
            Set(ByVal Value As DateTime)
                MyBase.SetDateTime(ColumnNames.FechaActualizacion, Value)
            End Set
        End Property

        Public Overridable Property CodResponsable As Integer
            Get
                Return MyBase.Getint(ColumnNames.CodResponsable)
            End Get
            Set(ByVal Value As Integer)
                MyBase.Setint(ColumnNames.CodResponsable, Value)
            End Set
        End Property


#End Region
	
	#Region "String Properties" 

		Public Overridable Property s_CodMovMaterial As String
			Get
				If Me.IsColumnNull(ColumnNames.CodMovMaterial) Then
					Return String.Empty
				Else
					Return MyBase.GetintAsString(ColumnNames.CodMovMaterial)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.CodMovMaterial)
				Else
					Me.CodMovMaterial = MyBase.SetintAsString(ColumnNames.CodMovMaterial, Value)
				End If
			End Set
		End Property

		Public Overridable Property s_CodNota As String
			Get
				If Me.IsColumnNull(ColumnNames.CodNota) Then
					Return String.Empty
				Else
					Return MyBase.GetintAsString(ColumnNames.CodNota)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.CodNota)
				Else
					Me.CodNota = MyBase.SetintAsString(ColumnNames.CodNota, Value)
				End If
			End Set
		End Property

		Public Overridable Property s_CodCompra As String
			Get
				If Me.IsColumnNull(ColumnNames.CodCompra) Then
					Return String.Empty
				Else
					Return MyBase.GetintAsString(ColumnNames.CodCompra)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.CodCompra)
				Else
					Me.CodCompra = MyBase.SetintAsString(ColumnNames.CodCompra, Value)
				End If
			End Set
		End Property

		Public Overridable Property s_Fecha As String
			Get
				If Me.IsColumnNull(ColumnNames.Fecha) Then
					Return String.Empty
				Else
					Return MyBase.GetDateTimeAsString(ColumnNames.Fecha)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.Fecha)
				Else
					Me.Fecha = MyBase.SetDateTimeAsString(ColumnNames.Fecha, Value)
				End If
			End Set
		End Property

		Public Overridable Property s_CodSeccion As String
			Get
				If Me.IsColumnNull(ColumnNames.CodSeccion) Then
					Return String.Empty
				Else
					Return MyBase.GetintAsString(ColumnNames.CodSeccion)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.CodSeccion)
				Else
					Me.CodSeccion = MyBase.SetintAsString(ColumnNames.CodSeccion, Value)
				End If
			End Set
		End Property

		Public Overridable Property s_MovimientoTipo As String
			Get
				If Me.IsColumnNull(ColumnNames.MovimientoTipo) Then
					Return String.Empty
				Else
					Return MyBase.GetstringAsString(ColumnNames.MovimientoTipo)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.MovimientoTipo)
				Else
					Me.MovimientoTipo = MyBase.SetstringAsString(ColumnNames.MovimientoTipo, Value)
				End If
			End Set
		End Property

		Public Overridable Property s_CodUsuario As String
			Get
				If Me.IsColumnNull(ColumnNames.CodUsuario) Then
					Return String.Empty
				Else
					Return MyBase.GetintAsString(ColumnNames.CodUsuario)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.CodUsuario)
				Else
					Me.CodUsuario = MyBase.SetintAsString(ColumnNames.CodUsuario, Value)
				End If
			End Set
		End Property

		Public Overridable Property s_FechaActualizacion As String
			Get
				If Me.IsColumnNull(ColumnNames.FechaActualizacion) Then
					Return String.Empty
				Else
					Return MyBase.GetDateTimeAsString(ColumnNames.FechaActualizacion)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.FechaActualizacion)
				Else
					Me.FechaActualizacion = MyBase.SetDateTimeAsString(ColumnNames.FechaActualizacion, Value)
				End If
			End Set
		End Property

		Public Overridable Property s_CodResponsable As String
			Get
				If Me.IsColumnNull(ColumnNames.CodResponsable) Then
					Return String.Empty
				Else
					Return MyBase.GetintAsString(ColumnNames.CodResponsable)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.CodResponsable)
				Else
					Me.CodResponsable = MyBase.SetintAsString(ColumnNames.CodResponsable, Value)
				End If
			End Set
		End Property


	#End Region  	

	#Region "Where Clause"
    Public Class WhereClause

        Public Sub New(ByVal entity As BusinessEntity)
            Me._entity = entity
        End Sub
		
		Public ReadOnly Property TearOff As TearOffWhereParameter
			Get
				If _tearOff Is Nothing Then
					_tearOff = new TearOffWhereParameter(Me)
				End If

				Return _tearOff
			End Get
		End Property

		#Region "TearOff's"
		Public class TearOffWhereParameter

			Public Sub New(ByVal clause As WhereClause)
				Me._clause = clause
			End Sub
		
	
			Public ReadOnly Property CodMovMaterial() As WhereParameter
				Get
					Dim where As WhereParameter = New WhereParameter(ColumnNames.CodMovMaterial, Parameters.CodMovMaterial)
                        Me._clause._entity.Query.AddWhereParameter(where)
                        Return where
                    End Get
                End Property

                Public ReadOnly Property CodNota() As WhereParameter
                    Get
                        Dim where As WhereParameter = New WhereParameter(ColumnNames.CodNota, Parameters.CodNota)
                        Me._clause._entity.Query.AddWhereParameter(where)
                        Return where
                    End Get
                End Property

                Public ReadOnly Property CodCompra() As WhereParameter
                    Get
                        Dim where As WhereParameter = New WhereParameter(ColumnNames.CodCompra, Parameters.CodCompra)
                        Me._clause._entity.Query.AddWhereParameter(where)
                        Return where
                    End Get
                End Property

                Public ReadOnly Property Fecha() As WhereParameter
                    Get
                        Dim where As WhereParameter = New WhereParameter(ColumnNames.Fecha, Parameters.Fecha)
                        Me._clause._entity.Query.AddWhereParameter(where)
                        Return where
                    End Get
                End Property

                Public ReadOnly Property CodSeccion() As WhereParameter
                    Get
                        Dim where As WhereParameter = New WhereParameter(ColumnNames.CodSeccion, Parameters.CodSeccion)
                        Me._clause._entity.Query.AddWhereParameter(where)
                        Return where
                    End Get
                End Property

                Public ReadOnly Property MovimientoTipo() As WhereParameter
                    Get
                        Dim where As WhereParameter = New WhereParameter(ColumnNames.MovimientoTipo, Parameters.MovimientoTipo)
                        Me._clause._entity.Query.AddWhereParameter(where)
                        Return where
                    End Get
                End Property

                Public ReadOnly Property CodUsuario() As WhereParameter
                    Get
                        Dim where As WhereParameter = New WhereParameter(ColumnNames.CodUsuario, Parameters.CodUsuario)
                        Me._clause._entity.Query.AddWhereParameter(where)
                        Return where
                    End Get
                End Property

                Public ReadOnly Property FechaActualizacion() As WhereParameter
                    Get
                        Dim where As WhereParameter = New WhereParameter(ColumnNames.FechaActualizacion, Parameters.FechaActualizacion)
                        Me._clause._entity.Query.AddWhereParameter(where)
                        Return where
                    End Get
                End Property

                Public ReadOnly Property CodResponsable() As WhereParameter
                    Get
                        Dim where As WhereParameter = New WhereParameter(ColumnNames.CodResponsable, Parameters.CodResponsable)
                        Me._clause._entity.Query.AddWhereParameter(where)
                        Return where
                    End Get
                End Property


			Private _clause as WhereClause
		End Class
		#End Region	

		Public ReadOnly Property CodMovMaterial() As WhereParameter 
			Get
				If _CodMovMaterial_W Is Nothing Then
					_CodMovMaterial_W = TearOff.CodMovMaterial
				End If
				Return _CodMovMaterial_W
			End Get
		End Property

		Public ReadOnly Property CodNota() As WhereParameter 
			Get
				If _CodNota_W Is Nothing Then
					_CodNota_W = TearOff.CodNota
				End If
				Return _CodNota_W
			End Get
		End Property

		Public ReadOnly Property CodCompra() As WhereParameter 
			Get
				If _CodCompra_W Is Nothing Then
					_CodCompra_W = TearOff.CodCompra
				End If
				Return _CodCompra_W
			End Get
		End Property

		Public ReadOnly Property Fecha() As WhereParameter 
			Get
				If _Fecha_W Is Nothing Then
					_Fecha_W = TearOff.Fecha
				End If
				Return _Fecha_W
			End Get
		End Property

		Public ReadOnly Property CodSeccion() As WhereParameter 
			Get
				If _CodSeccion_W Is Nothing Then
					_CodSeccion_W = TearOff.CodSeccion
				End If
				Return _CodSeccion_W
			End Get
		End Property

		Public ReadOnly Property MovimientoTipo() As WhereParameter 
			Get
				If _MovimientoTipo_W Is Nothing Then
					_MovimientoTipo_W = TearOff.MovimientoTipo
				End If
				Return _MovimientoTipo_W
			End Get
		End Property

		Public ReadOnly Property CodUsuario() As WhereParameter 
			Get
				If _CodUsuario_W Is Nothing Then
					_CodUsuario_W = TearOff.CodUsuario
				End If
				Return _CodUsuario_W
			End Get
		End Property

		Public ReadOnly Property FechaActualizacion() As WhereParameter 
			Get
				If _FechaActualizacion_W Is Nothing Then
					_FechaActualizacion_W = TearOff.FechaActualizacion
				End If
				Return _FechaActualizacion_W
			End Get
		End Property

		Public ReadOnly Property CodResponsable() As WhereParameter 
			Get
				If _CodResponsable_W Is Nothing Then
					_CodResponsable_W = TearOff.CodResponsable
				End If
				Return _CodResponsable_W
			End Get
		End Property

		Private _CodMovMaterial_W As WhereParameter = Nothing
		Private _CodNota_W As WhereParameter = Nothing
		Private _CodCompra_W As WhereParameter = Nothing
		Private _Fecha_W As WhereParameter = Nothing
		Private _CodSeccion_W As WhereParameter = Nothing
		Private _MovimientoTipo_W As WhereParameter = Nothing
		Private _CodUsuario_W As WhereParameter = Nothing
		Private _FechaActualizacion_W As WhereParameter = Nothing
		Private _CodResponsable_W As WhereParameter = Nothing

			Public Sub WhereClauseReset()

			_CodMovMaterial_W = Nothing
			_CodNota_W = Nothing
			_CodCompra_W = Nothing
			_Fecha_W = Nothing
			_CodSeccion_W = Nothing
			_MovimientoTipo_W = Nothing
			_CodUsuario_W = Nothing
			_FechaActualizacion_W = Nothing
			_CodResponsable_W = Nothing
				Me._entity.Query.FlushWhereParameters()

			End Sub
	
		Private _entity As BusinessEntity
		Private _tearOff As TearOffWhereParameter
    End Class	

	Public ReadOnly Property Where() As WhereClause
		Get
			If _whereClause Is Nothing Then
				_whereClause = New WhereClause(Me)
			End If
	
			Return _whereClause
		End Get
	End Property
	
	Private _whereClause As WhereClause = Nothing	
#End Region	

#Region "Aggregate Clause"
    Public Class AggregateClause

        Public Sub New(ByVal entity As BusinessEntity)
            Me._entity = entity
        End Sub
		
		Public ReadOnly Property TearOff As TearOffAggregateParameter
			Get
				If _tearOff Is Nothing Then
					_tearOff = new TearOffAggregateParameter(Me)
				End If

				Return _tearOff
			End Get
		End Property

		#Region "AggregateParameter TearOff's"
		Public class TearOffAggregateParameter

			Public Sub New(ByVal clause As AggregateClause)
				Me._clause = clause
			End Sub
		
	
		Public ReadOnly Property CodMovMaterial() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.CodMovMaterial, Parameters.CodMovMaterial)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property CodNota() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.CodNota, Parameters.CodNota)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property CodCompra() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.CodCompra, Parameters.CodCompra)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property Fecha() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.Fecha, Parameters.Fecha)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property CodSeccion() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.CodSeccion, Parameters.CodSeccion)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property MovimientoTipo() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.MovimientoTipo, Parameters.MovimientoTipo)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property CodUsuario() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.CodUsuario, Parameters.CodUsuario)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property FechaActualizacion() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.FechaActualizacion, Parameters.FechaActualizacion)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property CodResponsable() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.CodResponsable, Parameters.CodResponsable)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property


			Private _clause as AggregateClause
		End Class
		#End Region	

		Public ReadOnly Property CodMovMaterial() As AggregateParameter 
			Get
				If _CodMovMaterial_W Is Nothing Then
					_CodMovMaterial_W = TearOff.CodMovMaterial
				End If
				Return _CodMovMaterial_W
			End Get
		End Property

		Public ReadOnly Property CodNota() As AggregateParameter 
			Get
				If _CodNota_W Is Nothing Then
					_CodNota_W = TearOff.CodNota
				End If
				Return _CodNota_W
			End Get
		End Property

		Public ReadOnly Property CodCompra() As AggregateParameter 
			Get
				If _CodCompra_W Is Nothing Then
					_CodCompra_W = TearOff.CodCompra
				End If
				Return _CodCompra_W
			End Get
		End Property

		Public ReadOnly Property Fecha() As AggregateParameter 
			Get
				If _Fecha_W Is Nothing Then
					_Fecha_W = TearOff.Fecha
				End If
				Return _Fecha_W
			End Get
		End Property

		Public ReadOnly Property CodSeccion() As AggregateParameter 
			Get
				If _CodSeccion_W Is Nothing Then
					_CodSeccion_W = TearOff.CodSeccion
				End If
				Return _CodSeccion_W
			End Get
		End Property

		Public ReadOnly Property MovimientoTipo() As AggregateParameter 
			Get
				If _MovimientoTipo_W Is Nothing Then
					_MovimientoTipo_W = TearOff.MovimientoTipo
				End If
				Return _MovimientoTipo_W
			End Get
		End Property

		Public ReadOnly Property CodUsuario() As AggregateParameter 
			Get
				If _CodUsuario_W Is Nothing Then
					_CodUsuario_W = TearOff.CodUsuario
				End If
				Return _CodUsuario_W
			End Get
		End Property

		Public ReadOnly Property FechaActualizacion() As AggregateParameter 
			Get
				If _FechaActualizacion_W Is Nothing Then
					_FechaActualizacion_W = TearOff.FechaActualizacion
				End If
				Return _FechaActualizacion_W
			End Get
		End Property

		Public ReadOnly Property CodResponsable() As AggregateParameter 
			Get
				If _CodResponsable_W Is Nothing Then
					_CodResponsable_W = TearOff.CodResponsable
				End If
				Return _CodResponsable_W
			End Get
		End Property

		Private _CodMovMaterial_W As AggregateParameter = Nothing
		Private _CodNota_W As AggregateParameter = Nothing
		Private _CodCompra_W As AggregateParameter = Nothing
		Private _Fecha_W As AggregateParameter = Nothing
		Private _CodSeccion_W As AggregateParameter = Nothing
		Private _MovimientoTipo_W As AggregateParameter = Nothing
		Private _CodUsuario_W As AggregateParameter = Nothing
		Private _FechaActualizacion_W As AggregateParameter = Nothing
		Private _CodResponsable_W As AggregateParameter = Nothing

		Public Sub AggregateClauseReset()

		_CodMovMaterial_W = Nothing
		_CodNota_W = Nothing
		_CodCompra_W = Nothing
		_Fecha_W = Nothing
		_CodSeccion_W = Nothing
		_MovimientoTipo_W = Nothing
		_CodUsuario_W = Nothing
		_FechaActualizacion_W = Nothing
		_CodResponsable_W = Nothing
			Me._entity.Query.FlushAggregateParameters()

		End Sub
	
		Private _entity As BusinessEntity
		Private _tearOff As TearOffAggregateParameter
    End Class	

	Public ReadOnly Property Aggregate() As AggregateClause
		Get
			If _aggregateClause Is Nothing Then
				_aggregateClause = New AggregateClause(Me)
			End If
	
			Return _aggregateClause
		End Get
	End Property
	
	Private _aggregateClause As AggregateClause = Nothing	
#End Region	

	Protected Overrides Function GetInsertCommand() As IDbCommand
	
		Dim cmd As SqlCommand = New SqlCommand
		cmd.CommandType = CommandType.StoredProcedure
		cmd.CommandText = "[" + Me.SchemaStoredProcedure + "proc_MOV_MATERIALESInsert]" 
	    
		CreateParameters(cmd)
		
		Dim p As SqlParameter
		p = cmd.Parameters(Parameters.CodMovMaterial.ParameterName)
		p.Direction = ParameterDirection.Output
    
		Return cmd 

  	End Function
	
	Protected Overrides Function GetUpdateCommand() As IDbCommand
	
		Dim cmd As SqlCommand = New SqlCommand
		cmd.CommandType = CommandType.StoredProcedure    
		cmd.CommandText = "[" + Me.SchemaStoredProcedure + "proc_MOV_MATERIALESUpdate]" 
		
		CreateParameters(cmd) 
		    
		Return cmd
	
	End Function	
	
	Protected Overrides Function GetDeleteCommand() As IDbCommand
	
		Dim cmd As SqlCommand = New SqlCommand
		cmd.CommandType = CommandType.StoredProcedure    
		cmd.CommandText = "[" + Me.SchemaStoredProcedure + "proc_MOV_MATERIALESDelete]" 
		
		Dim p As SqlParameter
		p = cmd.Parameters.Add(Parameters.CodMovMaterial)
		p.SourceColumn = ColumnNames.CodMovMaterial
		p.SourceVersion = DataRowVersion.Current

  
		Return cmd
	
	End Function	
	
	Private Sub CreateParameters(ByVal cmd As SqlCommand)
	
		Dim p As SqlParameter
		p = cmd.Parameters.Add(Parameters.CodMovMaterial)
		p.SourceColumn = ColumnNames.CodMovMaterial
		p.SourceVersion = DataRowVersion.Current

		p = cmd.Parameters.Add(Parameters.CodNota)
		p.SourceColumn = ColumnNames.CodNota
		p.SourceVersion = DataRowVersion.Current

		p = cmd.Parameters.Add(Parameters.CodCompra)
		p.SourceColumn = ColumnNames.CodCompra
		p.SourceVersion = DataRowVersion.Current

		p = cmd.Parameters.Add(Parameters.Fecha)
		p.SourceColumn = ColumnNames.Fecha
		p.SourceVersion = DataRowVersion.Current

		p = cmd.Parameters.Add(Parameters.CodSeccion)
		p.SourceColumn = ColumnNames.CodSeccion
		p.SourceVersion = DataRowVersion.Current

		p = cmd.Parameters.Add(Parameters.MovimientoTipo)
		p.SourceColumn = ColumnNames.MovimientoTipo
		p.SourceVersion = DataRowVersion.Current

		p = cmd.Parameters.Add(Parameters.CodUsuario)
		p.SourceColumn = ColumnNames.CodUsuario
		p.SourceVersion = DataRowVersion.Current

		p = cmd.Parameters.Add(Parameters.FechaActualizacion)
		p.SourceColumn = ColumnNames.FechaActualizacion
		p.SourceVersion = DataRowVersion.Current

		p = cmd.Parameters.Add(Parameters.CodResponsable)
		p.SourceColumn = ColumnNames.CodResponsable
		p.SourceVersion = DataRowVersion.Current


	End Sub	

End Class

End NameSpace

